package mbalib.ui.managers
{
    import flash.display.*;

    public class DepthManager extends Object
    {

        public function DepthManager()
        {
            return;
        }// end function

        public static function bringToBottom(param1:DisplayObject) : void
        {
            var _loc_2:* = param1.parent;
            if (_loc_2 == null)
            {
                return;
            }
            if (_loc_2.getChildIndex(param1) != 0)
            {
                _loc_2.setChildIndex(param1, 0);
            }
            return;
        }// end function

        public static function bringToTop(param1:DisplayObject) : void
        {
            var _loc_2:* = param1.parent;
            if (_loc_2 == null)
            {
                return;
            }
            var _loc_3:* = _loc_2.numChildren - 1;
            if (_loc_2.getChildIndex(param1) != _loc_3)
            {
                _loc_2.setChildIndex(param1, _loc_3);
            }
            return;
        }// end function

        public static function isTop(param1:DisplayObject) : Boolean
        {
            var _loc_2:* = param1.parent;
            if (_loc_2 == null)
            {
                return true;
            }
            return (_loc_2.numChildren - 1) == _loc_2.getChildIndex(param1);
        }// end function

        public static function isBottom(param1:DisplayObject) : Boolean
        {
            var _loc_2:* = param1.parent;
            if (_loc_2 == null)
            {
                return true;
            }
            return _loc_2.getChildIndex(param1) == 0;
        }// end function

        public static function isJustBelow(param1:DisplayObject, param2:DisplayObject) : Boolean
        {
            var _loc_3:* = param1.parent;
            if (_loc_3 == null)
            {
                return false;
            }
            if (param2.parent != _loc_3)
            {
                return false;
            }
            return _loc_3.getChildIndex(param1) == (_loc_3.getChildIndex(param2) - 1);
        }// end function

        public static function isJustAbove(param1:DisplayObject, param2:DisplayObject) : Boolean
        {
            return isJustBelow(param2, param1);
        }// end function

    }
}
